package DataBase;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class RemoveItemFromSupplier {
	
	private String itemId;
	private String suppId;
	private int status=0;
	
	

	public RemoveItemFromSupplier(String item,String supp)
	{
		this.itemId=item;
		this.suppId=supp;
	}

	
	
	public void removeItemFromSupp()
	{
        SQLConnection sc=new SQLConnection();
		
		try {
			
			PreparedStatement ps1 = sc.getConnection().prepareStatement("DELETE FROM supplier_item WHERE  suppID=? AND iid=? ");	
			 ps1.setString(1,suppId);
			 ps1.setString(2,itemId);
			sc.getConnection().setAutoCommit(false);

			ps1.executeUpdate();
			sc.getConnection().commit();
			ps1.close();
			sc.getConnection().close();
			status=1;
		}
		
		catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		}
	
	
	
	
	
	public int getStatus() {
		return status;
	}






	public void setStatus(int status) {
		this.status = status;
	}
	
}
